package com.trainingcloud.config;

import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @Classname MyInterceptor
 * @Date 2022/10/9 15:54
 * @Author 纸鹤超努力
 */
@Component
public class MyInterceptor implements HandlerInterceptor {
  public boolean preHandle(HttpServletRequest request, HttpServletResponse response,Object handler) throws Exception{
    System.out.println("进入拦截器ing");
    String authorization = request.getHeader("Authorization");
    System.out.println(authorization);
//    逻辑代码
    //拦截器：代理AOP
    //登录放行为true，未登录为false
    return true;
  }
}
